xxxxxxxxxxmodule teapo.app.moreDialog { export class Model {​ text = ko.observable<string>(null); matchItems = ko.observableArray<Model.MatchItem>([]);​ constructor( currentFile: string, currentSelection: string, private _files: string[], private _completed: (selected: string) => void) { this.text(currentSelection || (currentFile ? currentFile.slice(1) : '')); this.matchItems.push(<any>'one'); this.matchItems.push(<any>'two'); this.matchItems.push(<any>'three'); }​ keydown(unused, e: KeyboardEvent) { if (e.keyCode === 13 || e.which === 13 || e.key === 'Enter') { this._keyEnter(); } else if (e.keyCode === 27 || e.which === 27 || e.key === 'Escape') { this._keyEnter(); } else if (e.keyCode === 38 || e.which === 38) { this._keyUp(); } else if (e.keyCode === 40 || e.which === 40) { this._keyDown(); } else { return true; } }​ acceptClick() { this._completed(this.text()); }​ dismiss() { this._completed(null); } private _keyEnter() { this._completed(this.text()); // TODO: pass back the result } private _keyUp() { }​ private _keyDown() { } }​ export module Model { export class MatchItem { } }}